from tensorflow.python.data.experimental.ops.testing import sleep

from service.simple_service import update_day_his
from utils.data_source import query, update, engine
from utils.data_utils import data_update

import akshare as ak

if __name__ == '__main__':
    results = query(
        """select * from (select *, ROW_NUMBER() OVER (partition by data order by (最低-昨收)/昨收 desc) AS rn from xl_result order by data) a where rn <3""")
    res_map = {}
    for ind in range(len(results)):
        data = results.loc[ind, 'data']
        if data not in res_map.keys():
            res_map.update({data: []})
        res_map[data].append(ind)

    for result in results:
        res_map[result[0]] = result[1]

    ye = 100000000
    cc = {}
    for result in results:
        print(result)
        myje = ye / (10 - len(cc))
        gj = 1
        gs = myje / gj
        ye = ye - gs * gj
        bh = '1111'
        cc[bh] = gs


# 买入
def mr(gp: list):
    return []


# 卖出
def mc(gp: list, date: str):
    return []
